const dgram = require('dgram');
const server = dgram.createSocket('udp4');

server.on('error', (err) => {
    console.log(err);
});

server.on('listening', () => {
    console.log('socket正在监听中...');
});

server.on('message', (msg, rInfo) => {
    console.log(`receive message from ${rInfo.address}:${rInfo.port}`);
    server.send('exit', rInfo.port, rInfo.address)
});

server.bind('8080', '127.0.0.1');
